home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / dev / gui / muibuilderv11.lha / muibuilder / mb / c / ClickMain.c < prev    next >
C/C++ Source or Header  |  1994-04-02  |  2KB  |  87 lines

  1. /* Libraries */
  2. #include <libraries/mui.h>
  3.  
  4. /* protos */
  5. #include <clib/muimaster_protos.h>
  6. #include <clib/alib_protos.h>
  7. #include <clib/dos_protos.h>
  8. #include <clib/exec_protos.h>
  9.  
  10. /*  Pragmas  */
  11. #include <pragmas/muimaster_pragmas.h>
  12. #include <pragmas/exec_pragmas.h>
  13.  
  14. /*  Ansi  */
  15. #include <stdlib.h>
  16. #include <stdio.h>
  17.  
  18. /* MUIBuilder */
  19. #include "Click.h"
  20.  
  21. /* defines */
  22. #define    ID_1ST    1
  23. #define    ID_2ND    2
  24. #define    ID_3RD    3
  25.  
  26. struct Library * MUIMasterBase;
  27.  
  28. /* Init function */
  29. static void init( void )
  30. {
  31.     if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  32.     {
  33.         printf("Can't Open MUIMaster Library");
  34.         exit(20);
  35.     }
  36. }
  37.  
  38. /* main function */
  39. main()
  40. {
  41.     struct ObjApp * App = NULL;    /* Application object */
  42.     char    *STR_Message1 = "\0338\033c You pressed first button";
  43.     char    *STR_Message2 = "\0338\033c You pressed second button";
  44.     char    *STR_Message3 = "\0338\033c You pressed third button";
  45.     BOOL    running = TRUE;
  46.     ULONG    signal;
  47.     extern struct ObjApp * CreateSmall_Example( void );
  48.  
  49.     /* Program initialisation ( you need to write it yourself) */
  50.     init();
  51.  
  52.     /* Create Application : generated by MUIBuilder */
  53.     App = CreateApp();
  54.  
  55.     /* Notification */
  56.     DoMethod(App->WI_try, MUIM_Notify, MUIA_Window_CloseRequest, TRUE, App->App, 2, MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
  57.     DoMethod( App->BT_1stbutton, MUIM_Notify, MUIA_Pressed, FALSE, App->App, 2, MUIM_Application_ReturnID, ID_1ST);
  58.     DoMethod( App->BT_2ndbutton, MUIM_Notify, MUIA_Pressed, FALSE, App->App, 2, MUIM_Application_ReturnID, ID_2ND);
  59.     DoMethod( App->BT_3rdbutton, MUIM_Notify, MUIA_Pressed, FALSE, App->App, 2, MUIM_Application_ReturnID, ID_3RD);
  60.     
  61.     /* Open Window */
  62.     set( App->WI_try, MUIA_Window_Open, TRUE );
  63.  
  64.     while (running)
  65.         {
  66.                 switch (DoMethod(App->App,MUIM_Application_Input,&signal))
  67.                 {
  68.         case ID_1ST:
  69.             set( App->TX_label_0, MUIA_Text_Contents, STR_Message1);
  70.             break;
  71.         case ID_2ND:
  72.             set( App->TX_label_0, MUIA_Text_Contents, STR_Message2);
  73.             break;
  74.         case ID_3RD:
  75.             set( App->TX_label_0, MUIA_Text_Contents, STR_Message3);
  76.             break;
  77.                 case MUIV_Application_ReturnID_Quit:
  78.                         running = FALSE;
  79.                         break;
  80.                 }
  81.     if (running && signal) Wait(signal);
  82.         }
  83.     DisposeApp(App);
  84.     CloseLibrary(MUIMasterBase);
  85.     exit(0);
  86. }
  87.